package abs

object Test {
    def main(args: Array[String]): Unit = {
        /**
          * 匿名类
          */
        val rt1 = new RationalTrait {
            // 匿名类在RationalTrait之后初始化，因此numberArg，denomArg对于RationalTrait初始化过程不可见
            override val numberArg: Int = 10
            override val denomArg: Int = 5
        }
        val rt2 = new {
            //预初始化字段 在RationalTrait初始化过程可见
            override val numberArg: Int = 8
            override val denomArg: Int = 7
        } with RationalTrait
    }
}
